package com.walterlife.dp.AdapterDP;

import org.apache.log4j.Logger;

public class SocketClassAdapterImpl extends Socket implements SocketAdapter {
    static Logger logger = Logger.getLogger(SocketClassAdapterImpl.class);

    public Volt get220Volt() {
        return getVolt();
    } 

    public Volt get12Volt() {
        return convertVolt(getVolt(), 18);
    } 

    public Volt get3Volt() {
        return convertVolt(getVolt(), 40);
    } 

    private Volt convertVolt(Volt v, int multi) {
        if(v == null) {
            logger.error("param Volt v is not valid !!!");
            return null;
        } 
        return new Volt(v.getVolts() / multi);
    } 
}

//public class SocketClassAdapterImpl implements SocketAdapter {
    
    //private Socket socket = new Socket();

    //public Volt get120Volt() {
        //return socket.getVolt();
    //} 

    //public Volt get12Volt() {
        //return convertVolt(socket.getVolt(), 10);
    //} 

    //public Volt get3Volt() {
        //return convertVolt(socket.getVolt(), 40);
    //} 

    ////private Volt convertVolt(Volt v, int multi) {
        //if(v == null) {
            //logger.error("param Volt v is not valid !!!");
            //return null;
        //} 
        //return new Volt(v.getVolts() / multi);
    //} 
//}
